<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CityData extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $this->execute("
            insert into sys_city(id, name, full_name, pid, has_child) values(1,'中国','中国',0,'true');
            insert into sys_city(id, name, full_name, pid, has_child) values(2,'云南','中国-云南',1,'true');
            insert into sys_city(id, name, full_name, pid, has_child) values(3,'昆明','中国-云南-昆明',2,'true');
            insert into sys_city(id, name, full_name, pid, has_child) values(4,'大理','中国-云南-昆明-大理',2,'true');
            insert into sys_city(id, name, full_name, pid, has_child) values(5,'西山区','中国-云南-昆明-西山区',3,'false');
            insert into sys_city(id, name, full_name, pid, has_child) values(6,'五华区','中国-云南-昆明-五华区',3,'false');
            insert into sys_city(id, name, full_name, pid, has_child) values(7,'洱源县','中国-云南-昆明-大理-洱源县',4,'false');
            insert into sys_city(id, name, full_name, pid, has_child) values(8,'大理市','中国-云南-昆明-大理-大理市',4,'false');
        ");
    }
}
